import * as echarts from 'echarts/core';
// 引入各种图表，图表后缀都为 Chart
import { BarChart, PieChart, LineChart } from 'echarts/charts'
// 系列类型的定义后缀都为 SeriesOption
import type { BarSeriesOption, PieSeriesOption, LineSeriesOption } from 'echarts/charts';
// 引入提示框，标题，直角坐标系等组件，组件后缀都为 Component
import {
  TitleComponent,
  TooltipComponent,
  GridComponent,
  LegendComponent,
  DataZoomComponent,
  VisualMapComponent,
} from 'echarts/components'
// 组件类型的定义后缀都为 ComponentOption
import type {
  LegendComponentOption,
  TitleComponentOption,
  TooltipComponentOption,
  GridComponentOption,
  DataZoomComponentOption,
  VisualMapComponentOption
} from 'echarts/components';
import { CanvasRenderer } from 'echarts/renderers'


export type ECOption = echarts.ComposeOption<
  | LineSeriesOption
  | BarSeriesOption
  | PieSeriesOption
  | GridComponentOption
  | TitleComponentOption
  | TooltipComponentOption
  | LegendComponentOption
  | DataZoomComponentOption
  | VisualMapComponentOption
>

// 注册必须的组件
echarts.use([
  BarChart,
  PieChart,
  LineChart,
  CanvasRenderer,
  TitleComponent,
  TooltipComponent,
  GridComponent,
  LegendComponent,
  DataZoomComponent,
  VisualMapComponent
])

export default echarts
